package namedemo1;

import com.alibaba.nacos.api.exception.NacosException;
import com.alibaba.nacos.api.naming.NamingFactory;
import com.alibaba.nacos.api.naming.NamingService;
import com.alibaba.nacos.api.naming.pojo.Instance;

import java.util.List;

public class find1 {

    public static void main(String[] args) throws NacosException {
        NamingService service = NamingFactory.createNamingService("localhost:8848");
        //获取实例
        List<Instance> app1 = service.getAllInstances("app1");
        System.out.println(app1);
//        List<Instance> app2 = service.getAllInstances("app1",true);
        Instance instance = service.selectOneHealthyInstance("app1");
        System.out.println("============");
        System.out.println(instance);
    }
}
